﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace XsClient.Common
{
    /// <summary>
    /// AppHelper
    /// 创建人：zhangyang
    /// 创建时间：2020/6/5 11:18:49
    /// </summary>
    internal class AppHelper
    {
        private List<XsSource> sources;
        private BookList bookList;
        /// <summary>
        /// 内容过滤对象
        /// </summary>
        private ContextFilter contextFilter = null;

        private AppHelper()
        {
            try
            {
                sources = XsConfig.Current?.Sources;
                bookList = BookList.Current;
                if (sources == null)
                {
                    sources = new List<XsSource>();
                    sources.Add(new XsSource() { ID = 1, Name = "笔趣阁", BaseUrl = "http://www.biquge.info/" });
                }
                contextFilter = ContextFilter.Current;
            }
            catch (Exception ex)
            {
                NewLife.Log.XTrace.WriteException(ex);
            }
        }
        private static AppHelper _instance;

        internal static AppHelper Instance
        {
            get
            {
                if (_instance == null)
                    _instance = new AppHelper();
                return _instance;
            }
        }

        public List<XsSource> Sources { get => sources; set => sources = value; }
        public BookList BookList { get => bookList; set => bookList = value; }
    }
}
